<?php
namespace app\index\controller;

use think\View;
use think\Controller;
use app\index\model\User as userModel;

class Index  extends Controller{
	
    public function index($question = 1) {
		
// 		$user = new User;
// 		$where = function($query) {
// 			$query -> where('id','>','0')
// 				   -> order('depart,point desc');
// 		};
// 		$list = $user->select($where);
		
// 		foreach ($list as $value){
			
			
// 			dump($value->getData());
// 		}

    	$list = [];
    	$this-> view -> assign('list', $list);
    	$this-> view -> assign('phone', 0);
    	return $this-> view -> fetch('index');
    	
    }
    
    public function test(){
    	$list = userModel::all(function($query){
    		$query -> where('point','<','50')
    			   -> order('depart desc,point desc');
    	});
    	foreach ($list as $key => $value){
    		dump($value->getdata());
    	}
    	
    }
    
    public function demo($days=30, $week=4) {
    	$arr = [
    		
    	];
    	$num = $days + $week;
    	$period = intval($num/7) + 1;
    	//echo($period);
    	for( $i = 0; $i < $num; $i++){
    		if($i < $week){
	    		$arr[$i] = 0;
    		} else {
    			$arr[$i] = $i - $week + 1;
    		}
    	}
    	echo ('日.  一.   二.   三.   四.   五.   六<br>');
    	foreach ($arr as $key =>$value){
    		echo sprintf('%10s', $value);
    		if($value < 10){
	    		echo '&nbsp;&nbsp;';
    		}
    		
    		if( $key != -1 && ($key+1)%7 == 0){
    			echo("<br>");
    		}
    	}
    	
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

    
}
